Skip to content

[Mirror] Fix Windows desktop OS build version reporting#5

Open
bmehta001 wants to merge 7 commits into
mainfrom
bhamehta/fix-windows-os-version
Open

[Mirror] Fix Windows desktop OS build version reporting#5
bmehta001 wants to merge 7 commits into
mainfrom
bhamehta/fix-windows-os-version

Conversation

@bmehta001
Copy link
Copy Markdown
Owner

@bmehta001 bmehta001 commented May 21, 2026

Mirror of upstream PR microsoft#1441 for review by @GovM-MSFT. Source of truth is the upstream PR; this mirror is kept in sync.

Summary

  • Stop using stale BuildLabEx to populate the Windows desktop OsBuild / �xt.os.ver field.
  • Use the Windows-team-recommended source of truth: RtlGetVersion().dwBuildNumber for the running OS build, combined with the registry UBR (Update Build Revision) for serviced builds.
  • Add Windows PAL unit tests for the formatted OS full version with UBR present, UBR absent, and a zero UBR.

Fixes microsoft#1407

⚠️ Behavior change for downstream telemetry consumers

Please include this in the release notes for the next tagged build.

Before this PR, DeviceInfo.OsBuild / ext.os.ver on Windows desktop could be a BuildLabEx-style string (e.g. 26100.1.amd64fre.ge_release.240331-1435). After this PR it is always a numeric major.minor.build[.ubr] value (e.g. 10.0.26100.4061).

If you maintain downstream consumers of DeviceInfo.OsBuild / ext.os.ver, please audit those queries before the next release containing this change rolls out.

Why this source

Confirmed with the Windows team:

Ideally use the API, and it is always safe to combine with UBR. The API and the registry should always be in sync. The reason the registry can be used is for offline reading.

So we prefer RtlGetVersion() (kernel-authoritative for the running OS) and add UBR from HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\UBR. The registry CurrentBuildNumber / CurrentBuild precedence chain is not needed here — those are useful for offline-reading another Windows installation's hive, not the live running OS.

Validation

  • msbuild Solutions\MSTelemetrySDK.sln /t:Tests\UnitTests /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v145
  • UnitTests.exe --gtest_filter=PalTests.* → 10 tests passed, including the three new WindowsOsFullVersion* cases
  • UnitTests.exe (full run) → 463 tests passed

bmehta001 and others added 4 commits May 18, 2026 17:29
Use servicing-aware registry values so desktop telemetry reports the current Windows build instead of stale BuildLabEx data after OS updates.

Files changed:

- lib/pal/desktop/WindowsDesktopSystemInformationImpl.cpp

- tests/unittests/PalTests.cpp

Fixes microsoft#1407

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refactor the Windows OS full-version composition into a testable helper so registry and Rtl build source precedence can be covered without depending on the host machine state.

The new PAL tests cover CurrentBuildNumber precedence, CurrentBuild fallback, Rtl build fallback, and missing UBR formatting so future key or fallback regressions are caught before merge.

Files changed:

- lib/pal/desktop/WindowsDesktopSystemInformationImpl.cpp

- tests/unittests/PalTests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a deterministic PAL test proving that UBR value 0 is still included when the source reports it as present. This keeps zero-value handling separate from the missing-UBR fallback.

Files changed:

- tests/unittests/PalTests.cpp

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@trancified trancified left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

bmehta001 and others added 3 commits May 22, 2026 01:48
Per Windows-team guidance on issue microsoft#1407: the RtlGetVersion() API is the
authoritative source for the running OS build number, and the registry
CurrentBuildNumber / CurrentBuild values are only useful for offline
reads of another Windows installation. For the running OS the API and
registry are always in sync, so prefer the API. UBR is registry-only and
is always safe to combine with the kernel-provided build number.

Drop the registry CurrentBuildNumber / CurrentBuild precedence chain and
the now-unused getCurrentVersionStringValue helper. Format the OS full
version directly from rtlOsvi.dwBuildNumber plus the optional UBR.

Update PalTests to cover the simplified formatter (UBR present, UBR
missing, zero UBR present), replacing the obsolete source-precedence
tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 force-pushed the bhamehta/fix-windows-os-version branch from 5042ec7 to 78e6db4 Compare May 23, 2026 00:01
@bmehta001 bmehta001 requested a review from trancified May 23, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] 1DS reports OS version of the base OS at RTM and does not reflect any servicing updates

2 participants